#include "GameState.h"
#include "IGameEvent.h"

using namespace ChuGame;

void GameState::applyEvent(boost::shared_ptr<const ENE::IGameEvent> event)
{
	m_events.push_front(event);

	while(m_events.size() && m_events.back()->getTimestamp() < m_clock.getTick() - m_limit)
	{
		m_events.back()->apply(m_oldData);
		m_events.pop_back();
	}
}

Clock& GameState::getClock()
{
	return m_clock;
}